﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace YXQ.Common.Meta
{
    public class RenderTable<T>
    {
        StringBuilder sb = new StringBuilder();
        StringBuilder sbContent=new StringBuilder();
        public string BuildTable(string tablename, List<T> tList)
        {
            List<CommFunction.ReportTableColumn> columns = CommFunction.LoadReportTableColumn(tablename);
            BuildTableHead(columns,tList);
            

            //foreach (var t in tList)
            //{
            //    BuildTableContent(t);
            //}

            return sb.ToString();
        }
        public string BuildTableHead(List<CommFunction.ReportTableColumn> columns, List<T> tList)
        {
            int i = 0;
            for (int j = 0; j < columns.Count; j++)
            {
                sb.AppendFormat("<td>{0}</td>", columns[i].sourceColumnName);
            }


            //foreach (var reportTableColumn in columns)
            //{
                
            //    sb.AppendFormat("<td>{0}</td>", reportTableColumn.sourceColumnName);
               
            //}


            return sb.ToString(); 
        }

        public string BuildTableContent(TableList table)
        {
            //foreach (var content in model)
            //{
            //    sb.AppendFormat("<tr>");
            //    sb.AppendFormat("");
            //    sb.AppendFormat("</tr>");
            //}
            return "";
        }

    }

    public class TableList
    {
        public string Filed { get; set; }
        public string FiledValue { get; set; }
    }
}
